﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.Skins;
using DevExpress.LookAndFeel;
using DevExpress.UserSkins;
using DevExpress.XtraEditors;
using System.Threading;
using DevExpress.XtraSplashScreen;


namespace PRO_DOCS.DocumentManagementSystem.ADMIN.WIN
{
    public partial class MainForm : BLL.WIN.Templates.DevxPermissionTemplate
    {
        [Browsable(false)]
        SelectionOptions CurrentSelectionOption
        {
            get;
            set;
        }

        private enum SelectionOptions
        {
            SystemRoles = 0,
            UsersManagement = 1,
            ModulesSecurity = 11,
            SavingDirectories = 2,
            DocumentTypes = 3,
            SystemDepartments = 4,
            DepartmentFolderStructures = 5,
            UserAccessLog = 6,
            RealTimeAccessLog = 7,
            DepartmentsActivityAmount = 12,
            BackupRestore = 10,
            MapsCategories = 13,
            WorkFlowSettings = 8,
            EmailSettings = 9,
            ApplicationWorkFlows = 14,
            //------------------------->
            ApplicationWorkFlowSteps = 15




        }

        public MainForm()
        {

            InitializeComponent();
            Thread.Sleep(5000);

        }

        private void btnGroupLinks_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            DevExpress.XtraNavBar.NavBarItem currentSelectedLink = (DevExpress.XtraNavBar.NavBarItem)sender;
            SelectionOptions _currentSelectionOption = (SelectionOptions)Convert.ToInt32(currentSelectedLink.Tag.ToString());

            if (CurrentSelectionOption.Equals(_currentSelectionOption))
            {
                return;
            }

            CurrentSelectionOption = _currentSelectionOption;

            panelControl1.Controls.Clear();

            SplashScreenManager.ShowForm(typeof(WaitForm1), true, true);
            switch (CurrentSelectionOption)
            {
                case SelectionOptions.SystemRoles:
                    panelControl1.Controls.Add(new Configurations.Users.RolesManagement());
                    break;
                case SelectionOptions.UsersManagement:
                    panelControl1.Controls.Add(new Configurations.Users.UserManagement());
                    break;
                case SelectionOptions.SavingDirectories:
                    panelControl1.Controls.Add(new Configurations.Storage.SavingDirectories());
                    break;
                case SelectionOptions.DocumentTypes:
                    panelControl1.Controls.Add(new Configurations.Documents.DocumentTypes.DocumentTypes());
                    break;
                case SelectionOptions.SystemDepartments:
                    panelControl1.Controls.Add(new Configurations.Departments.Departments());
                    break; 
                case SelectionOptions.DepartmentFolderStructures:
                    panelControl1.Controls.Add(new Configurations.Departments.FolderStructureBuilder());
                    break;
                case SelectionOptions.RealTimeAccessLog:
                    panelControl1.Controls.Add(new Configurations.Dashboard.RealTimeUserAccessLog());
                    break;
                case SelectionOptions.UserAccessLog:
                    panelControl1.Controls.Add(new Configurations.Dashboard.UsersAccessLog());
                    break;
                case SelectionOptions.DepartmentsActivityAmount:
                    panelControl1.Controls.Add(new Configurations.Dashboard.UserActivityAmount());
                    break;
                case SelectionOptions.WorkFlowSettings:
                    panelControl1.Controls.Add(new PRO_DOCS.DocumentManagementSystem.ADMIN.WIN.Configurations.EmailsAndWorkflows.WorkFlowSystemSettings());
                    break;
                case SelectionOptions.EmailSettings:
                    panelControl1.Controls.Add(new PRO_DOCS.DocumentManagementSystem.ADMIN.WIN.Configurations.EmailsAndWorkflows.EmailSettings());
                    break;
                case SelectionOptions.BackupRestore:
                    panelControl1.Controls.Add(new PRO_DOCS.DocumentManagementSystem.Petrolium.WIN.Back.BackupSettings());
                    break;
                case SelectionOptions.ModulesSecurity:
                    panelControl1.Controls.Add(new Configurations.Security.ucModulesSecurity());
                    break;
                case SelectionOptions.MapsCategories:
                    panelControl1.Controls.Add(new Configurations.Maps.MapsCategoriesSettings());
                    break;
                case SelectionOptions.ApplicationWorkFlows:
                    panelControl1.Controls.Add(new PRO_DOCS.DocumentManagementSystem.ADMIN.WIN.Configurations.EmailsAndWorkflows.ApplicatinWorkflows());
                    break;
                case SelectionOptions.ApplicationWorkFlowSteps:
                    panelControl1.Controls.Add(new PRO_DOCS.DocumentManagementSystem.ADMIN.WIN.Configurations.EmailsAndWorkflows.ApplicationWorkflowSteps());
                    break;   
                 
                default:
                    break;
            }
            if (panelControl1.Controls.Count > 0)
            {
                panelControl1.Controls[0].Dock = DockStyle.Fill;
            }
            SplashScreenManager.CloseForm();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {

            panelControl1.Controls.Add(new Configurations.Users.RolesManagement());
            panelControl1.Controls[0].Dock = DockStyle.Fill;

        }

    }
}